package com.bosssoft.hr.train.j2se.example.exception;

/**
 * @description 自定义注解异常
 * @author ChenTong
 * @date 2020/5/28
 */
public class MyException extends RuntimeException{
    private final int code;

    public MyException(int code, String message, Throwable cause) {
        super(message, cause);
        this.code=code;
    }

    public MyException(ExceptionCode code){
        super(code.getMsg());
        this.code = code.getCode();
    }

    public MyException(ExceptionCode exceptionCode, Throwable cause){
        super(cause.getMessage(),cause);
        this.code = exceptionCode.getCode();
    }

    public int getCode() {
        return code;
    }


}
